<template>
  <div>

    <div>重新生成的源码，将覆盖原有源码，请备份好，再执行？</div>
    <el-button class="filter-item" size="small" type="primary" icon="el-icon-setting" @click="handleCreateBuildCode4Row(1)" style="margin-top: 10px;">只生成前端Vue</el-button>
    <el-button class="filter-item" size="small" type="primary" icon="el-icon-setting" @click="handleCreateBuildCode4Row(3)" style="margin-top: 10px;">只生成后端通用模板部分</el-button>
    <br/>
    <br/>
    <br/>
    <el-divider content-position="left">轻易别点我，会覆盖后端自定义代码部分</el-divider>
    <el-button class="filter-item" size="small" type="primary" icon="el-icon-setting" @click="handleCreateBuildCode4Row(4)" style="margin-top: 10px;">只生成后端自定义部分</el-button>
    <el-button class="filter-item" size="small" type="primary" icon="el-icon-setting" @click="handleCreateBuildCode4Row(2)" style="margin-top: 10px;">生成后端所有</el-button>
    <el-button class="filter-item" size="small" type="primary" icon="el-icon-setting" @click="handleCreateBuildCode4Row(0)" style="margin-top: 10px;">生成前后端所有</el-button>  <br/>
    <br/>
    <br/>
  </div>
</template>

<!--
All(0, "生成所有"),
Vue(1, "前端"),
ServiceAll(2, "后端所有"),
ServiceTmpt(3, "后端通用模板部分"),
ServiceMyself(4, "后端自定义部分");
-->
<script>
import {gen2LevelMenuApi} from './tmpt-list-api'
export default {
  name: 'GenCode',
  props: {
    keyRandom: String,
    tmptId: Number,
    tmptTableName: String
  },
  data() {
    return {
      coding_menu_id: 668,

    }
  },

  methods: {
    // 重新生成源码
    handleCreateBuildCode4Row(genType) {
      const data = {
        'menu1Id': this.coding_menu_id,
        '_id': this.tmptId,
        'pageType': 'datagrid-sourcecode',
        'menu2Name': this.tmptTableName,
        'keyRandom': this.keyRandom,
        'genType':genType
      }
      gen2LevelMenuApi(data).then(r => {
        this.notify(r)
      })
    },


  }
}
</script>

<style scoped>

</style>
